package com.edooteach.api.servcice;

import com.edoomath.entity.tecent.WechatAccount;
import com.edoomath.entity.tecent.WechatOpenid;
import com.edoomath.entity.user.User;
import com.edoomath.entity.user.UserCredit;
import com.edoomath.entity.user.UserSource;
import com.edoomath.entity.user.UserWallet;

/**
 * 
 * @author houtao
 *
 */
public interface UserService extends DataService<User> {
	
    /**
     * 
     * @param unionid
     * @return
     */
    public User create(String unionid);
    
    /**
     * 
     * @param mobile
     * @param openid
     * @param unionid
     * @param isEmail
     * @return
     */
    public User login(String mobile, String openid, String unionid);
    
    /**
     * 
     * @param mobile
     */
    public void bindUserMobile(User user, String mobile);
    
    /**
     * 
     * @param unionid
     * @return
     */
    public User load(String unionid);
    
    /**
     * 
     * @param user
     * @return
     */
    public User getParent(User user);
    
    /**
     * 
     * @param mobile
     * @return
     */
    public User loadByMobile(String mobile);
    
    /**
     * 
     * @param unionid
     * @param email
     * @return
     */
    public User editEmail(String unionid, String email);
    
    /**
     * 
     * @param unionid
     * @return
     */
    public WechatAccount loadWechatAccount(String unionid);
    
    /**
     * 
     * @param unionid
     * @param userSource
     * @return
     */
    public WechatOpenid loadWechatOpenid(String unionid, UserSource userSource);
    
    /**
     * 
     * @param unionid
     * @param openid
     * @param userSource
     */
    public void saveWechatOpenid(String unionid, String openid, UserSource userSource);
    
    /**
     * 
     * @param user
     * @return
     */
    public UserWallet saveOrGetUserWallet(User user);
    
    /**
     * 
     * @param user
     * @return
     */
    public UserCredit saveOrGetUserCredit(User user);
}
